Skip to content

fix: implement manual PKCS#7 signature verification#205

Closed
bryan-anthropic wants to merge 1 commit intomainfrom
fix/pkcs7-verification
Closed

fix: implement manual PKCS#7 signature verification#205
bryan-anthropic wants to merge 1 commit intomainfrom
fix/pkcs7-verification

Conversation

@bryan-anthropic
Copy link
Collaborator

Summary

Fixes #21.

  • node-forge's p7.verify() method is not implemented, causing mcpb verify to always report "unsigned" status.
  • Replaces the non-functional call with manual PKCS#7 verification: verifies message digest in authenticated attributes matches content hash (SHA-256), then verifies the RSA signature over authenticated attributes using the certificate's public key.
  • Fixes self-signed certificate detection to correctly report "self-signed" status for cryptographically valid self-signed signatures (previously returned "unsigned").

Original fix by Joan Xie. Clean cherry-pick onto current main (original branch had trivial rebase conflict in test formatting).

Test plan

  • All existing signing and verification tests pass (109 total)
  • yarn build:code compiles cleanly
  • Self-signed certificates now correctly report "self-signed" instead of "unsigned"

🤖 Generated with Claude Code

Replace non-functional node-forge p7.verify() with manual PKCS#7
verification. node-forge throws "not yet implemented" on verify(),
causing mcpb verify to always report unsigned status.

The fix manually verifies the message digest in authenticated attributes
matches the content hash, then verifies the RSA signature over the
authenticated attributes using the certificate's public key.

Also fixes self-signed certificate detection to correctly report
"self-signed" status even when chain validation fails.

Original fix by Joan Xie.

Co-Authored-By: Joan Xie <joan@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ERROR: Extension is not signed

1 participant